#! /bin/sh

name=nyancat
version=1.5.2
revision=1
tarball_url="https://github.com/klange/nyancat/archive/refs/tags/${version}.tar.gz"
tarball_blake2b="4c197c7d630edc7184b57fd2b33fb422a69120e2db2994bc326e772278bca9fa1cc8a837da747bc7a9114090d43133ad48e22ed3319fc92485f82c1e7b5e67b9"
hostdeps="gcc pkg-config"
deps="core-libs"

build() {
    cp -rp "${source_dir}"/. ./

    make \
        CC=${OS_TRIPLET}-gcc \
        CFLAGS="$TARGET_CFLAGS -std=c99" \
        CPPFLAGS="$TARGET_CPPFLAGS" \
        LDFLAGS="$TARGET_LDFLAGS" \
        -j${parallelism}
}

package() {
    install -d "${dest_dir}${prefix}"/bin
    install src/nyancat "${dest_dir}${prefix}"/bin/
    install -d "${dest_dir}${prefix}"/share/man/man1
    install -m 644 nyancat.1 "${dest_dir}${prefix}"/share/man/man1/

    post_package_strip
}
